package com.shujia.userprofile.info.social

import com.shujia.utils.{HBaseTools, SparkTool}
import org.apache.spark.sql.{DataFrame, Row, SparkSession}

object UserPhoneTag extends SparkTool {
  tableName = "user_info"
  columnFamily = "social"
  tagName = "phone"

  override def extractData(spark: SparkSession): DataFrame = {
        import org.apache.spark.sql.functions._
        import spark.implicits._

        // 从用户维度表中提取性别标签
        spark
          .table("dim.dim_pub_user_info_d_f").where($"pt" === pt)
          // 以用户id作为rk，提取用户性别最终写入HBase
          .select($"id".cast("String")
            , $"phone"
          )

  }

//  override def saveDF(df: DataFrame): Unit = {
//    HBaseTools.saveToHBase(df, tableName, columnFamily, tagName)
//  }
}
